package com.rain.cy.framework.exception;

import com.rain.cy.framework.result.ErrorCodeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author chen_yu
 * @date 2020年7月23日19:55:48
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class BaseException extends RuntimeException {

    private int code;

    private String message;

    public BaseException(ErrorCodeEnum resultEnum) {
        super(resultEnum.getMessage());
        this.message = resultEnum.getMessage();
        this.code = resultEnum.getCode();
    }

    public BaseException(String message) {
        super(message);
        this.message =message;
        this.code = ErrorCodeEnum.Fail.getCode();
    }
}
